<template>
  <div>
    <h5>当前最新的count值为:{{ count }}</h5>
    <h5>{{ showNum }}</h5>
    <button @click="handleSub">-5</button>
    <button @click="handleSubAsync">-5 async</button>
  </div>
</template>
<script>
import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
export default {
  data () {
    return {}
  },
  methods: {
    ...mapMutations(['sub']),
    ...mapActions(['subAsync']),
    handleSub () {
      this.sub(5)
    },
    handleSubAsync () {
      this.subAsync(5)
    }
  },
  computed: {
    ...mapState(['count']),
    ...mapGetters(['showNum'])
  }
}
</script>
